import { BaseRegionCode } from '../config/geoserver';
import request from '/@/utils/request';
import { BaseAppCode } from '/@/config/geoserver';
import { Session } from '/@/utils/storage';

/**
 * 获取设备列表
 * /res/region/list
 */
export function getLotdeviceregisterList(data: Object) {
    const accessToken = Session.get("deviceToken");
    return request({
        url: '/iot/lotdeviceregister/getList',
        method: 'POST',
        data,
        headers: {
            accessToken,
        },
    });
}

export function getStatisticsMaxAndMinData(params: Object) {
    return request({
        url: '/iot/lotDataBstWeatherStation/getStatisticsMaxAndMinData',
        method: 'GET',
        params,
    });
}


export function getLast(params: Object) {
    return request({
        url: '/iot/lotDataBstWeatherStation/getLast',
        method: 'GET',
        params,
    });
}


export function getPestDataByJoin(params: Object) {
    return request({
        url: '/iot/lotDataBstPestForecastV2/getDataByJoin',
        method: 'GET',
        params,
    });
}

export function getDataCq8(params: Object) {
    return request({
        url: '/iot/lotDataBstPestForecastV2/getDataCq8',
        method: 'GET',
        params,
    });
}


export function getSoilStatisticsMaxAndMinData(params: Object) {
    return request({
        url: '/iot/bstsoil/getStatisticsMaxAndMinData',
        method: 'GET',
        params,
    });
}


export function getLastUpload(params: Object) {
    return request({
        url: '/iot/bstsoil/getLastUpload',
        method: 'GET',
        params,
    });
}
/**
 * 获取播放地址
 * @param params 
 * @returns 
 */
export function getVideoPlayAddress(params:any){
    const accessToken = Session.get("deviceToken");
    return request({
        url:'/iot/camera/getPlayAddress',
        params,
        headers: {
            accessToken,
        },
    })
}
/**
 * 获取设备统计
 * @returns 
 */
export function getDeviceStat(){
    const accessToken = Session.get("deviceToken");
    return request({
        url:'/iot/lotdeviceregister/summary',
        params:{typeCode:'01'},
        headers: {
            accessToken,
        },
    })
}